import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/task/patrol_scheme_entity.dart';

PatrolSchemeEntity $PatrolSchemeEntityFromJson(Map<String, dynamic> json) {
  final PatrolSchemeEntity patrolSchemeEntity = PatrolSchemeEntity();
  final int? allowCrossInspection = jsonConvert.convert<int>(json['allowCrossInspection']);
  if (allowCrossInspection != null) {
    patrolSchemeEntity.allowCrossInspection = allowCrossInspection;
  }
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    patrolSchemeEntity.companyCode = companyCode;
  }
  final int? completionRate = jsonConvert.convert<int>(json['completionRate']);
  if (completionRate != null) {
    patrolSchemeEntity.completionRate = completionRate;
  }
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    patrolSchemeEntity.createBy = createBy;
  }
  final String? createById = jsonConvert.convert<String>(json['createById']);
  if (createById != null) {
    patrolSchemeEntity.createById = createById;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    patrolSchemeEntity.createDate = createDate;
  }
  final String? deleted = jsonConvert.convert<String>(json['deleted']);
  if (deleted != null) {
    patrolSchemeEntity.deleted = deleted;
  }
  final int? doesItExist = jsonConvert.convert<int>(json['doesItExist']);
  if (doesItExist != null) {
    patrolSchemeEntity.doesItExist = doesItExist;
  }
  final String? enableOrNot = jsonConvert.convert<String>(json['enableOrNot']);
  if (enableOrNot != null) {
    patrolSchemeEntity.enableOrNot = enableOrNot;
  }
  final String? endTime = jsonConvert.convert<String>(json['endTime']);
  if (endTime != null) {
    patrolSchemeEntity.endTime = endTime;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    patrolSchemeEntity.id = id;
  }
  final String? inspectionDepartment = jsonConvert.convert<String>(json['inspectionDepartment']);
  if (inspectionDepartment != null) {
    patrolSchemeEntity.inspectionDepartment = inspectionDepartment;
  }
  final String? inspectionPersonnel = jsonConvert.convert<String>(json['inspectionPersonnel']);
  if (inspectionPersonnel != null) {
    patrolSchemeEntity.inspectionPersonnel = inspectionPersonnel;
  }
  final String? inspectionPersonnelName = jsonConvert.convert<String>(json['inspectionPersonnelName']);
  if (inspectionPersonnelName != null) {
    patrolSchemeEntity.inspectionPersonnelName = inspectionPersonnelName;
  }
  final String? inspectionType = jsonConvert.convert<String>(json['inspectionType']);
  if (inspectionType != null) {
    patrolSchemeEntity.inspectionType = inspectionType;
  }
  final String? inspectionTypeName = jsonConvert.convert<String>(json['inspectionTypeName']);
  if (inspectionTypeName != null) {
    patrolSchemeEntity.inspectionTypeName = inspectionTypeName;
  }
  final int? lateNum = jsonConvert.convert<int>(json['lateNum']);
  if (lateNum != null) {
    patrolSchemeEntity.lateNum = lateNum;
  }
  final String? locateMode = jsonConvert.convert<String>(json['locateMode']);
  if (locateMode != null) {
    patrolSchemeEntity.locateMode = locateMode;
  }
  final int? numberOfHiddenHazardsNum = jsonConvert.convert<int>(json['numberOfHiddenHazardsNum']);
  if (numberOfHiddenHazardsNum != null) {
    patrolSchemeEntity.numberOfHiddenHazardsNum = numberOfHiddenHazardsNum;
  }
  final int? numberOfPoints = jsonConvert.convert<int>(json['numberOfPoints']);
  if (numberOfPoints != null) {
    patrolSchemeEntity.numberOfPoints = numberOfPoints;
  }
  final String? planName = jsonConvert.convert<String>(json['planName']);
  if (planName != null) {
    patrolSchemeEntity.planName = planName;
  }
  final String? plannedEndTime = jsonConvert.convert<String>(json['plannedEndTime']);
  if (plannedEndTime != null) {
    patrolSchemeEntity.plannedEndTime = plannedEndTime;
  }
  final int? reExaminationNum = jsonConvert.convert<int>(json['reExaminationNum']);
  if (reExaminationNum != null) {
    patrolSchemeEntity.reExaminationNum = reExaminationNum;
  }
  final String? scheduledStartTime = jsonConvert.convert<String>(json['scheduledStartTime']);
  if (scheduledStartTime != null) {
    patrolSchemeEntity.scheduledStartTime = scheduledStartTime;
  }
  final int? taskGrade = jsonConvert.convert<int>(json['taskGrade']);
  if (taskGrade != null) {
    patrolSchemeEntity.taskGrade = taskGrade;
  }
  final List<dynamic>? taskIds = (json['taskIds'] as List<dynamic>?)?.map(
          (e) => e).toList();
  if (taskIds != null) {
    patrolSchemeEntity.taskIds = taskIds;
  }
  final int? taskNum = jsonConvert.convert<int>(json['taskNum']);
  if (taskNum != null) {
    patrolSchemeEntity.taskNum = taskNum;
  }
  final int? taskStatus = jsonConvert.convert<int>(json['taskStatus']);
  if (taskStatus != null) {
    patrolSchemeEntity.taskStatus = taskStatus;
  }
  final List<dynamic>? tasks = (json['tasks'] as List<dynamic>?)?.map(
          (e) => e).toList();
  if (tasks != null) {
    patrolSchemeEntity.tasks = tasks;
  }
  final int? theNumberOfTasksToBeCompleted = jsonConvert.convert<int>(json['theNumberOfTasksToBeCompleted']);
  if (theNumberOfTasksToBeCompleted != null) {
    patrolSchemeEntity.theNumberOfTasksToBeCompleted = theNumberOfTasksToBeCompleted;
  }
  final List<dynamic>? unitPlans = (json['unitPlans'] as List<dynamic>?)?.map(
          (e) => e).toList();
  if (unitPlans != null) {
    patrolSchemeEntity.unitPlans = unitPlans;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    patrolSchemeEntity.updateBy = updateBy;
  }
  final String? updateById = jsonConvert.convert<String>(json['updateById']);
  if (updateById != null) {
    patrolSchemeEntity.updateById = updateById;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    patrolSchemeEntity.updateDate = updateDate;
  }
  final String? workDayType = jsonConvert.convert<String>(json['workDayType']);
  if (workDayType != null) {
    patrolSchemeEntity.workDayType = workDayType;
  }
  return patrolSchemeEntity;
}

Map<String, dynamic> $PatrolSchemeEntityToJson(PatrolSchemeEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['allowCrossInspection'] = entity.allowCrossInspection;
  data['companyCode'] = entity.companyCode;
  data['completionRate'] = entity.completionRate;
  data['createBy'] = entity.createBy;
  data['createById'] = entity.createById;
  data['createDate'] = entity.createDate;
  data['deleted'] = entity.deleted;
  data['doesItExist'] = entity.doesItExist;
  data['enableOrNot'] = entity.enableOrNot;
  data['endTime'] = entity.endTime;
  data['id'] = entity.id;
  data['inspectionDepartment'] = entity.inspectionDepartment;
  data['inspectionPersonnel'] = entity.inspectionPersonnel;
  data['inspectionPersonnelName'] = entity.inspectionPersonnelName;
  data['inspectionType'] = entity.inspectionType;
  data['inspectionTypeName'] = entity.inspectionTypeName;
  data['lateNum'] = entity.lateNum;
  data['locateMode'] = entity.locateMode;
  data['numberOfHiddenHazardsNum'] = entity.numberOfHiddenHazardsNum;
  data['numberOfPoints'] = entity.numberOfPoints;
  data['planName'] = entity.planName;
  data['plannedEndTime'] = entity.plannedEndTime;
  data['reExaminationNum'] = entity.reExaminationNum;
  data['scheduledStartTime'] = entity.scheduledStartTime;
  data['taskGrade'] = entity.taskGrade;
  data['taskIds'] = entity.taskIds;
  data['taskNum'] = entity.taskNum;
  data['taskStatus'] = entity.taskStatus;
  data['tasks'] = entity.tasks;
  data['theNumberOfTasksToBeCompleted'] = entity.theNumberOfTasksToBeCompleted;
  data['unitPlans'] = entity.unitPlans;
  data['updateBy'] = entity.updateBy;
  data['updateById'] = entity.updateById;
  data['updateDate'] = entity.updateDate;
  data['workDayType'] = entity.workDayType;
  return data;
}

extension PatrolSchemeEntityExtension on PatrolSchemeEntity {
  PatrolSchemeEntity copyWith({
    int? allowCrossInspection,
    String? companyCode,
    int? completionRate,
    String? createBy,
    String? createById,
    String? createDate,
    String? deleted,
    int? doesItExist,
    String? enableOrNot,
    String? endTime,
    String? id,
    String? inspectionDepartment,
    String? inspectionPersonnel,
    String? inspectionPersonnelName,
    String? inspectionType,
    String? inspectionTypeName,
    int? lateNum,
    String? locateMode,
    int? numberOfHiddenHazardsNum,
    int? numberOfPoints,
    String? planName,
    String? plannedEndTime,
    int? reExaminationNum,
    String? scheduledStartTime,
    int? taskGrade,
    List<dynamic>? taskIds,
    int? taskNum,
    int? taskStatus,
    List<dynamic>? tasks,
    int? theNumberOfTasksToBeCompleted,
    List<dynamic>? unitPlans,
    String? updateBy,
    String? updateById,
    String? updateDate,
    String? workDayType,
  }) {
    return PatrolSchemeEntity()
      ..allowCrossInspection = allowCrossInspection ?? this.allowCrossInspection
      ..companyCode = companyCode ?? this.companyCode
      ..completionRate = completionRate ?? this.completionRate
      ..createBy = createBy ?? this.createBy
      ..createById = createById ?? this.createById
      ..createDate = createDate ?? this.createDate
      ..deleted = deleted ?? this.deleted
      ..doesItExist = doesItExist ?? this.doesItExist
      ..enableOrNot = enableOrNot ?? this.enableOrNot
      ..endTime = endTime ?? this.endTime
      ..id = id ?? this.id
      ..inspectionDepartment = inspectionDepartment ?? this.inspectionDepartment
      ..inspectionPersonnel = inspectionPersonnel ?? this.inspectionPersonnel
      ..inspectionPersonnelName = inspectionPersonnelName ?? this.inspectionPersonnelName
      ..inspectionType = inspectionType ?? this.inspectionType
      ..inspectionTypeName = inspectionTypeName ?? this.inspectionTypeName
      ..lateNum = lateNum ?? this.lateNum
      ..locateMode = locateMode ?? this.locateMode
      ..numberOfHiddenHazardsNum = numberOfHiddenHazardsNum ?? this.numberOfHiddenHazardsNum
      ..numberOfPoints = numberOfPoints ?? this.numberOfPoints
      ..planName = planName ?? this.planName
      ..plannedEndTime = plannedEndTime ?? this.plannedEndTime
      ..reExaminationNum = reExaminationNum ?? this.reExaminationNum
      ..scheduledStartTime = scheduledStartTime ?? this.scheduledStartTime
      ..taskGrade = taskGrade ?? this.taskGrade
      ..taskIds = taskIds ?? this.taskIds
      ..taskNum = taskNum ?? this.taskNum
      ..taskStatus = taskStatus ?? this.taskStatus
      ..tasks = tasks ?? this.tasks
      ..theNumberOfTasksToBeCompleted = theNumberOfTasksToBeCompleted ?? this.theNumberOfTasksToBeCompleted
      ..unitPlans = unitPlans ?? this.unitPlans
      ..updateBy = updateBy ?? this.updateBy
      ..updateById = updateById ?? this.updateById
      ..updateDate = updateDate ?? this.updateDate
      ..workDayType = workDayType ?? this.workDayType;
  }
}
